﻿CREATE TABLE Service (
id int IDENTITY(1,1) CONSTRAINT ServicePK PRIMARY KEY,
name nvarchar(50) NOT NULL,
url nvarchar(255) NOT NULL,
needs int NOT NULL,
maxRecipiens int NOT NULL,
maxChars int NOT NULL,
type int NOT NULL,
maxMessages int NOT NULL,
mmType int NOT NULL,
charsToReplace ntext NOT NULL,
charsToCount ntext NOT NULL,
welcome ntext NOT NULL
)
;
CREATE TABLE ServiceConfig (
idService int NOT NULL CONSTRAINT ServiceConfigPK PRIMARY KEY,
username nvarchar(255),
password nvarchar(255),
nickname nvarchar(255)
)
;
CREATE TABLE ServiceStat (
idService int NOT NULL CONSTRAINT ServiceStatPK PRIMARY KEY,
date datetime NOT NULL,
mexSent int NOT NULL
)
;
CREATE TABLE Config (
ckey nvarchar(255) NOT NULL CONSTRAINT ConfigPK PRIMARY KEY,
cvalue nvarchar(255)
)
;
CREATE TABLE MessagesSent (
idMessage int IDENTITY(1,1) CONSTRAINT MessageSentPK PRIMARY KEY,
idService int NOT NULL,
sentDate datetime NOT NULL,
message ntext NOT NULL
)
;
CREATE TABLE RecipientsForMessagesSent (
idRecipient int IDENTITY(1,1) CONSTRAINT RecipientsForMessagesSentPK PRIMARY KEY,
idMessageSent int NOT NULL,
label nvarchar(50) NOT NULL,
value nvarchar(50) NOT NULL
)
;
CREATE TABLE LastMessageSent (
idService int CONSTRAINT LastMessageSentPK PRIMARY KEY,
idMessage int,
saved bit NOT NULL
)
;
INSERT INTO Config (ckey, cvalue) VALUES ('_build_of_', '20080518')